LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.std_logic_arith.all;


ENTITY fc_dist_const IS
  PORT( 
  rst         : IN     STD_LOGIC;
  clk         : IN     STD_LOGIC;
  start			 : IN	 STD_LOGIC;
  wheel_size	: IN	 NATURAL RANGE 0 TO 28 :=25;
  distance_const2 : OUT	 STD_LOGIC_VECTOR( 63 DOWNTO 0);
  distance_const : OUT	 STD_LOGIC_VECTOR( 63 DOWNTO 0)
  );
END ENTITY  fc_dist_const ;


ARCHITECTURE v OF  fc_dist_const IS
CONSTANT c_dist : integer := 28712;
CONSTANT km_dist: integer := 798;

BEGIN
	PROCESS(rst, clk) 
	VARIABLE v_dist : integer;
	VARIABLE k_dist : integer;
	BEGIN 
		IF rst='1' THEN
			distance_const <= (OTHERS => '0');
			distance_const2 <= (others => '0');
		ELSIF RISING_EDGE(clk) THEN
			IF start = '1' THEN
				v_dist:= c_dist * wheel_size;
				k_dist:= km_dist * wheel_size;
				distance_const <= CONV_STD_LOGIC_VECTOR(v_dist,distance_const'length);
				distance_const2 <= CONV_STD_LOGIC_VECTOR(k_dist,distance_const2'length);
			END IF;
		END IF;
   	END PROCESS;
END ARCHITECTURE v;